//
//  HEMyOrderDetailsFooterCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/5.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEMyOrderDetailsFooterCell.h"

@interface HEMyOrderDetailsFooterCell ()

@property (nonatomic, strong) UILabel *titleLb;
@property (nonatomic, strong) UILabel *totalLb;

@end

@implementation HEMyOrderDetailsFooterCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
     if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
         self.selectionStyle = UITableViewCellSelectionStyleNone;
         [self initUI];
     }
     return self;;
 }

- (void)initUI {
    
    UIView *headLine = [UIView new];
    headLine.backgroundColor = CSplitLineColor;
    [self.contentView addSubview:headLine];
    [headLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView);
        make.height.mas_offset(1);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(self.contentView).mas_offset(-10);
    }];
    
    _titleLb = [UILabel new];
    _titleLb.font = DYFont(16);
    _titleLb.text = @"实付款";
    _titleLb.textColor = CNavLightBlackColor;
    [self.contentView addSubview:_titleLb];

    _totalLb = [UILabel new];
    _totalLb.font = DYFont(16);
    _totalLb.text = @"（含运费￥0.00）￥0.00";
    _totalLb.textColor = CNavLightBlackColor;
    _totalLb.textAlignment = NSTextAlignmentRight;
    _totalLb.numberOfLines = 0;
    _totalLb.lineBreakMode = NSLineBreakByCharWrapping;
    [self.contentView addSubview:_totalLb];
    
     [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(headLine.mas_bottom).mas_offset(15);
         make.left.equalTo(self.contentView).mas_offset(15);
         make.right.equalTo(_totalLb.mas_left).mas_offset(-15);
     }];
    [_titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    [_totalLb setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];

    [_totalLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headLine.mas_bottom).mas_offset(15);
        make.left.equalTo(_titleLb.mas_right);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.bottom.equalTo(self.contentView).mas_offset(-15);
    }];
    
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {
    _totalLb.attributedText = self.formModel.od_details.KFooterAmount;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
